Preview - Charge Interactions Chem/Phys

Behind the Scenes - How does the Simulation Work?


Now that we have figured out the mathematical model for the electrical interaction (which we call Coulomb's Law of electric force), we can look at the computer code that makes the simulation work. Scroll further down this page and click on "NetLogo Code" and click the arrow to open up that section. We will use this code to answer a few questions.


Referenced Questions

These questions were answered in the previous steps. They are provided here for your reference.

What value did you determine for the constant, "k" in the equation? Be sure to report a value AND appropriate units!

Questions

Please answer the questions below.

In the last section, we found a value for the proportionality constant k. This number has to be programmed into the code somewhere.  See if you can find what line of code the value for k shows up. 

What line (#) of code defines k?

Hint: if you skipped the directions above, click on the dropdown button labeled NetLogo Code...


Along with k, the program needs to know the value of the charges and their separation.  Let's look at a few NetLogo interface buttons to see how to set values using the slider bar.  At the top of the NetLogo window, you'll see a little lock sign next to the phrase "Mode: Interactive". Click on this lock and it should change to "Mode: Authoring". Now right click on the button that controls charge_1, and click "edit". The value of "charge_1" is a "global variable" because it works throughout the whole program. Try changing it to another name such as your name, and click "OK". 

What happened? Why do you think this happened? Could you change the code in such a way that this name would work?


The most important thing our program does is actually calculates the value of the electric force interaction. Look through the code to see if you can find where this takes place, and then copy/paste the line(s) of code that calculates the electric force.  

Hint: NetLogo uses the command "set" to store a value. For example, if I wrote set answer 3 + 4, the variable "answer" would hold the value "7".


Brainstorm with your partner(s) about how you could add to the program to allow you to look at the effect of two charges acting on a third. For now let's keep it simple and pretend like all three charges are colinear (in a straight line). List any ideas you come up with for what you would need to change or add to make this happen.

Note: You don't have to be a NetLogo whiz to answer this question. Just try to think about what the program does now, and brainstorm what you would have to do to let the program work with three charges instead of two.


Notes

These notes will appear on every page in this lesson so feel free to put anything here you'd like to keep track of.